
import {
    NEW_TAB
} from  '../mutation-types'

const state = {
    tableNum:0,
    curSeclected:0,
    proItem:'日志',
    newTab:'',
    tabList:[ {
            'title':'导游日志',
            'delShow':false,
            'show':false,
            'active':true,
            'id':+new Date(),
            'components': 'JournalProDefault',
            'text': 'infor0'
        }
    ],
}

const mutations = {
    DEFAULT_JOURNAL_TAB(state){
        state.tabList=[ {
            'title':'导游日志',
            'delShow':false,
            'show':false,
            'active':true,
            'id':+new Date(),
            'components': 'JournalProDefault',
            'text': 'infor0'
        }]
        state.curSeclected = 0;
        state.tableNum= 0;
    },
    NEW_JOURNAL_TAB(state,tableLabel){
        state.tableNum++;
        var newTab = {
            // 'title':tableLabel.title+state.tableNum,
            'title':tableLabel.title,
            'delShow':true,
            'show':true,
            'active':true,
            'id':+new Date(),
            'components': tableLabel.components,
            'text': 'infor'+state.tableNum,
            'dataId':tableLabel.dataId, 
        };
        state.curSeclected = state.tableNum;

        state.tabList.push(newTab);        

    },
    TOGGle_JOURNAL_COMPONENT_BTN(state,componentIndex){
        state.curSeclected = componentIndex;
    },
    DELETE_JOURNAL_BTN(state,index){ 
        state.tabList.splice(index, 1);
        state.curSeclected = 0;
        state.tableNum--;
    },
}

export default {
    state,
    mutations
}